package com.lyh.test.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lyh.test.entity.User;
import com.lyh.test.service.UserService;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Controller
@ResponseBody
@RequestMapping("/user")
public class UserController {
	@Autowired
	UserService userService;

	@RequestMapping(value = "/test", method = { RequestMethod.GET })
	public String testMethod() {
		String res = userService.queryUser();
		System.out.println("res = " + res);
		User user = new User();
		user.setId("hhhhh");
		log.info("user.getId() = " + user.getId());
		log.info("getId().toString() = " + user.getId().toString());
		return "testMethod res = " + res;
//		return "testMethod res = ";
	}

	@RequestMapping(value = "login", method = { RequestMethod.POST })
	public String login(@RequestBody Map<String, String> params) {
		String res = userService.queryUser();
		System.out.println("res = " + res);
		return "login res = " + res;
	}

}
